/***********************************************************************************************************************
 * This file was generated by the MCUXpresso Config Tools. Any manual edits made to this file
 * will be overwritten if the respective MCUXpresso Config Tools is used to update this file.
 **********************************************************************************************************************/

/* clang-format off */
/* TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
!!GlobalInfo
product: Peripherals v13.0
processor: MIMXRT1062xxxxB
package_id: MIMXRT1062DVL6B
mcu_data: ksdk2_0
processor_version: 14.0.1
board: MIMXRT1060-EVKB
functionalGroups:
- name: BOARD_InitPeripherals
  UUID: 96c1cec6-3bd3-47a2-8301-f38e4b0dd25f
  called_from_default_init: true
  selectedCore: core0
 * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/

/* TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
component:
- type: 'system'
- type_id: 'system_54b53072540eeeb8f8e9343e71f28176'
- global_system_definitions:
  - user_definitions: ''
  - user_includes: ''
 * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/

/* TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
component:
- type: 'uart_cmsis_common'
- type_id: 'uart_cmsis_common_9cb8e302497aa696fdbb5a4fd622c2a8'
- global_USART_CMSIS_common:
  - quick_selection: 'default'
 * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/

/* TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
component:
- type: 'gpio_adapter_common'
- type_id: 'gpio_adapter_common_57579b9ac814fe26bf95df0a384c36b6'
- global_gpio_adapter_common:
  - quick_selection: 'default'
 * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/
/* clang-format on */

/***********************************************************************************************************************
 * Included files
 **********************************************************************************************************************/
#include "peripherals.h"

/***********************************************************************************************************************
 * BOARD_InitPeripherals functional group
 **********************************************************************************************************************/
/***********************************************************************************************************************
 * NVIC initialization code
 **********************************************************************************************************************/
/* clang-format off */
/* TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
instance:
- name: 'NVIC'
- type: 'nvic'
- mode: 'general'
- custom_name_enabled: 'false'
- type_id: 'nvic_57b5eef3774cc60acaede6f5b8bddc67'
- functional_group: 'BOARD_InitPeripherals'
- peripheral: 'NVIC'
- config_sets:
  - nvic:
    - interrupt_table: []
    - interrupts: []
 * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/
/* clang-format on */

/* Empty initialization function (commented out)
static void NVIC_init(void) {
} */

/***********************************************************************************************************************
 * TRNG initialization code
 **********************************************************************************************************************/
/* clang-format off */
/* TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
instance:
- name: 'TRNG'
- type: 'trng'
- mode: 'General'
- custom_name_enabled: 'false'
- type_id: 'trng_b11006dc1e99bc2587291a4f4a561256'
- functional_group: 'BOARD_InitPeripherals'
- peripheral: 'TRNG'
- config_sets:
  - fsl_trng:
    - settings_trng_config_t:
      - clockMode: 'kTRNG_ClockModeRingOscillator'
      - clockSource: 'BusInterfaceClock'
      - struct_ring_oscillator:
        - ringOscDiv: 'kTRNG_RingOscDiv0'
        - sampleMode: 'kTRNG_SampleModeRaw'
      - entropyDelay: '3200'
      - sampleSize: '2500'
      - sparseBitLimit: '63'
      - retryCount: '1'
      - lock: 'false'
      - struct_statistical_checks:
        - longRunMaxLimit: '34'
        - monobitLimit:
          - maximum: '1384'
          - minimum: '1116'
        - runBit1Limit:
          - maximum: '405'
          - minimum: '227'
        - runBit2Limit:
          - maximum: '220'
          - minimum: '98'
        - runBit3Limit:
          - maximum: '125'
          - minimum: '37'
        - runBit4Limit:
          - maximum: '75'
          - minimum: '11'
        - runBit5Limit:
          - maximum: '47'
          - minimum: '1'
        - runBit6PlusLimit:
          - maximum: '47'
          - minimum: '1'
        - pokerLimit:
          - maximum: '26912'
          - minimum: '24445'
        - frequencyCountLimit:
          - maximum: '25600'
          - minimum: '1600'
    - quick_selection: 'Default'
 * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/
/* clang-format on */
const trng_config_t TRNG_config = {
  .lock = false,
  .clockMode = kTRNG_ClockModeRingOscillator,
  .ringOscDiv = kTRNG_RingOscDiv0,
  .sampleMode = kTRNG_SampleModeRaw,
  .entropyDelay = 3200,
  .sampleSize = 2500,
  .sparseBitLimit = 63,
  .retryCount = 1,
  .longRunMaxLimit = 34U,
  .monobitLimit = {
    .maximum = 1384UL,
    .minimum = 1116UL
  },
  .runBit1Limit = {
    .maximum = 405UL,
    .minimum = 227UL
  },
  .runBit2Limit = {
    .maximum = 220UL,
    .minimum = 98UL
  },
  .runBit3Limit = {
    .maximum = 125UL,
    .minimum = 37UL
  },
  .runBit4Limit = {
    .maximum = 75UL,
    .minimum = 11UL
  },
  .runBit5Limit = {
    .maximum = 47UL,
    .minimum = 1UL
  },
  .runBit6PlusLimit = {
    .maximum = 47UL,
    .minimum = 1UL
  },
  .pokerLimit = {
    .maximum = 26912UL,
    .minimum = 24445UL
  },
  .frequencyCountLimit = {
    .maximum = 25600UL,
    .minimum = 1600UL
  }
};

static void TRNG_init(void) {
  /* Initialize TRNG. */
  TRNG_Init(TRNG_PERIPHERAL, &TRNG_config);
}

/***********************************************************************************************************************
 * Initialization functions
 **********************************************************************************************************************/
void BOARD_InitPeripherals(void)
{
  /* Initialize components */
  TRNG_init();
}

/***********************************************************************************************************************
 * BOARD_InitBootPeripherals function
 **********************************************************************************************************************/
void BOARD_InitBootPeripherals(void)
{
  BOARD_InitPeripherals();
}
